<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name='format-detection' content='telephone=no' />
<title>人车人</title><link rel="icon" href="/assets/img/titleico.ico" type="image/x-icon">
<link rel="stylesheet" href="/assets/css/common.css" />
<link rel="stylesheet" href="/assets/css/iconfont/iconfont.css" />
<style>
body {
	background-color: #fff;
}

section {
	background-color: #fff;
	padding-bottom: 6rem;
}

#uploadpage .container {
	padding: 0;
}

section .container .addorder ul.formlist li {
	background-color: #fff;
	padding: .6rem 0;
}

section .container .addorder ul.formlist li .icon {
	padding: 4px;
	border-radius: 6px;
	margin-right: 5%;
}

section .container .addorder ul.formlist li i {
	color: #c7c7c7;
	font-size: 2.2rem;
	transform-origin: 10px;
}

section .container .addorder ul.formlist li .info .posbor {
	position: absolute;
	width: 100%;
	bottom: 0;
}

section .container .addorder ul.formlist li .info i {
	font-size: 2rem;
	display: none;
	opacity: 1;
}

section .container .addorder ul.formlist li i.fail {
	color: #fd0421;
	opacity: 0;
}

section .container .addorder ul.formlist li i.success {
	color: #5cb85c;
	display: none;
}

section .container .addorder ul.formlist li label {
	padding: 2% 5%;
	width: 90%;
	align-items: center;
}

section .container .addorder ul.formlist li label span {
	font-size: 1.5rem;
	padding: 0;
	padding-right: .8rem;
}

section .container .addorder ul.formlist li label input {
	color: #a7a7a7;
	width: 100%;
	font-size: 1.6rem;
}

section .container .addorder ul.formlist li label input[type=date] {
	color: #333;
}

section .container .addorder ul.formlist li label select {
	font-size: 1.6rem;
}

section .container .addorder ul.formlist li.hide {
	visibility: hidden;
	height: 0;
	overflow: hidden;
	padding: 0;
}

section .container .addorder a {
	position: relative;
	display: block;
	padding: 0;
	width: 90%;
	text-align: center;
	margin: 3% auto;
	border-radius: 6px;
	background-color: #5cb85c;
	color: #fff;
	height: 3.2rem;
	line-height: 3.2rem;
}

section .container .addorder a:active {
	background-color: #59ab59;
}

section .container p.title {
	padding: .4rem 2rem;
	background-color: #eaeaea;
}

section .container .info {
	padding: 1.4rem 0;
}

section .container .info div.flex {
	text-align: center;
}

section .container .info div.flex div {
	line-height: 2rem;
}

section .container .list li {
	padding: 1.5rem 5%;
	-webkit-justify-content: space-between;
	justify-content: space-between;
	font-size: 1.4rem;
	-webkit-align-items: center;
	align-items: center;
	position: relative;
}

section .container .list li a {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

section .container .list li span {
	text-indent: 1rem;
}

section .container .list li i.iconfont {
	font-size: 2rem;
}

section .container .list li i.new {
	font-size: 1.8rem;
	color: #f00;
	position: absolute;
	top: 0;
	left: 0;
}

section .container .list li div {
	text-align: center;
}

section .container .out {
	display: block;
	margin: 1rem auto;
	width: 90%;
	height: 2.8 rem;
	line-height: 2.8rem;
	text-align: center;
	background-color: #fff;
	border-radius: 99px;
	border: 1px solid #007aff;
	color: #007aff;
}

section .container .list li p.name {
	width: 5rem;
}

section .container .nolist {
	display: none;
	text-align: center;
	margin-top: 24%;
}

a.add,a.perfectmsg {
	display: block;
	padding: 3% 0;
	width: 90%;
	text-align: center;
	margin: 3% auto;
	border-radius: 6px;
	background-color: #5cb85c;
	color: #fff;
}

::-webkit-input-placeholder {
	color: #fd0421;
}

.fliebox ul li .title {
	padding: 2% 5%;
	width: 90%;
	-webkit-align-items: center;
	align-items: center;
	-webkit-justify-content: space-between;
	justify-content: space-between;
}

.fliebox ul li .upbox {
	-webkit-align-items: center;
	align-items: center;
	-webkit-flex-flow: column;
	flex-flow: column;
	text-align: center;
}

.fliebox ul li .upbox .uplabel {
	position: relative;
	padding: 2%;
	width: 40%;
	border: 1px dashed #007aff;
	overflow: hidden;
	height: 10rem;
}

.fliebox ul li .upbox .uplabel .showimg {
	position: absolute;
	width: 96%;
	height: 96%;
	top: 2%;
	left: 2%;
	background-color: #fff;
	display: none;
}

.fliebox ul li .upbox .uplabel .showimg img {
	-webkit-filter: blur(3px);
	filter: blur(3px);
	position: relative;
	top: 0;
	left: 0;
}

.fliebox ul li .upbox .uplabel .hide {
	display: none;
}

.fliebox ul li .upbox .uplabel .loadingbox {
	position: absolute;
	width: 100%;
	height: 100%;
	z-index: 3;
	align-items: center;
	justify-content: center;
	top: 0;
	left: 0;
}

.fliebox ul li .upbox .uplabel .loadingbox .loading {
	width: 3rem;
	height: 3rem;
	border-top: .4rem solid rgba(0, 0, 0, 0.2);
	border-right: .4rem solid rgba(0, 0, 0, 0.2);
	border-bottom: .4rem solid rgba(0, 0, 0, 0.2);
	border-left: .4rem solid #ffffff;
	border-radius: 50%;
}

.fliebox ul li .upbox .uplabel i {
	font-size: 6.6rem;
}

.fliebox ul li .upbox .uplabel .up {
	padding-bottom: .8rem;
}

.fliebox ul li .upbox .uplabel input {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	opacity: 0;
	z-index: 2;
}

.fliebox ul li .imagename {
	padding: .6rem;
	line-height: 1.8rem;
	text-align: center;
}

.fliebox ul li .imagename span {
	color: #606060;
	font-size: 1.6rem;
}

.fliebox ul li .imagename a {
	display: none;
	padding: .4rem 1rem;
}

.fliebox ul li .imagename a i {
	vertical-align: middle;
	color: #fd0421;
}

.fliebox ul li .upbox .uplabel .animation {
	-webkit-animation: loading 1s infinite linear;
	animation: loading 1s infinite linear;
}
</style>
<script src="/assets/js/jquery-3.1.1.min.js"></script>
</head>
<body>
	#@tabHead("业务管理",true) #@loadContainer()
	<div id="show-template" class="show-template trans">
		<div class="loading"></div>
		<img src="" />
	</div>
	<section id="uploadpage" class="visiblecon sectrans">
		<div class="container">
			<!--         	<div class="addorder"> -->
			<!--         		<p class="title">新增订单</p> -->
			<!-- 	        	<form id="form"> -->
			<!-- 	            	<ul class="formlist t_bor b_bor" id="ordercon"></ul> -->
			<!-- 	            	<a href="javascript:;" class="subbtn" id="subbtn" data-issub="false">下一步</a> -->
			<!-- 	            </form> -->
			<!--         	</div> -->
			<div class="orderlist">
				<!--<div class="nolist" id="nolist">
	        		<a href="/makeprice" class="add">新增订单</a>
	        	</div>-->
				<ul class="list" id="ulcon">

				</ul>
			</div>
		</div>
	</section>

	<!-- footer start -->
	#--#@footer(2)--#
	<!-- end footer -->

	<script src="/assets/js/fastclick.min.js"></script>
	<script src="/assets/js/xxsg.js"></script>
	<script src="/assets/js/exif.min.js"></script>
	<script>
    	$(function(){
    		
    		//判断是否完善资料
    		var navbtnDom = $("#navbtn"),
    			userprogress = navbtnDom.data("userprogress");
    		if(userprogress != 4){
    			$("section").removeClass("visiblecon").children().remove();
    			$("#load-container").remove();
    			
    			if(userprogress == 3){
    				$("section").append("<a href='/userCenter/perfectMsg' class='perfectmsg' style='margin-top: 55%;background-color:#F0AD4E'>有反馈信息</a>");
    				return;
    			}
    			
    			$("section").append("<a href='/userCenter/perfectMsg' class='perfectmsg' style='margin-top: 55%;'>请实名认证</a>");
    			return;
    		}
    		
    		var section = $("#uploadpage"),
    			ulDom = $("#ulcon"),
    			bodyDom = document.body;//用于窗口滚动
    		$.ajax({
    			type:"post",
    			url:"/userCenter/getOrderList",
    			success:function(data){
    				console.log(data)
    				if(_x.isEmpty(data)){//没有数据
    					showSuc();
    					$("#nolist").fadeIn();
    				}
    				getBaseTab(data,showSuc);
    			}
    		})
    		
    		function getBaseTab(data,callback){
				if(_x.isEmpty(data))return false;
				/*for(var i = 0;i < data.applyInfo.length;i++){
					var input = "",
						selectVal = data.applyInfo[i].selectValue,
						hideCls = "hide";
					if(_x.isEmpty(selectVal)){
						var type = "text";
						if(data.applyInfo[i].iputType == "number"){
							type = "tel";
						}				
						input = "<input class='flex empty' type="+ type +" id="+ data.applyInfo[i].paramterName +" name="+ data.applyInfo[i].paramterName +" />";
					}else{
						var selects = selectVal.split(",");
						hideCls = "";
						input = "<select id="+ data.applyInfo[i].paramterName +" name="+ data.applyInfo[i].paramterName +" class="+ data.applyInfo[i].paramterName +"><option value=''>--请选择--</option>";
						for(var j = 0;j < selects.length;j++){
							input += "<option value="+ selects[j] +">"+ selects[j] +"</option>";
						}
						input += "</select>";
					}
					var html = "<li class='b_bor trans "+ hideCls +"'>"+
			           	    "    <label class='flexbox'>"+
			                "        <div class='icon'>"+
			                "            <i class='iconfont fail'>&#xe602;</i>"+
			                "            <i class='iconfont success'>&#xe641;</i>"+
			                "        </div>"+
			                "        <span>"+ data.applyInfo[i].zhExpl +":</span>"+
			                		input+
			                "	  </label>"+		
			                "</li>";
					$("#ordercon").append(html);
				}*/
				if(data.orders.length == 0)callback();
				//按最新排序
				data.orders.sort(function(a,b){
					var aDate = a.order_id.substring(2),
						bDate = b.order_id.substring(2);
					return bDate - aDate;
				})
				for(var i = 0;i < data.orders.length;i++){
					var html = "",
						progress = data.orders[i].progress,
						now = "";
					if(progress == 0){
						now = "申请中";
					}else if(progress == 1){
						now = "审核中";
					}else if(progress == 2){
						now = "已放款";
					}else if(progress == 3){
						now = "贷后未寄回";
					}else if(progress == 4){
						now = "贷后已寄回";
					}else if(progress == 5){
						now = "逾期未还";
					}else if(progress == 6){
						now = "客户放弃";
					}
					
					var itemTypeFilter = data.orders[i].itemType.replace(/[^0-9]/g,"")
					html += "<li class='flexbox b_bor ac' order_id='"+ data.orders[i].order_id +"'>"+
			        		"	<a href='/userCenter/orderManager/"+ data.orders[i].order_id +"'></a>"+
			        		"	<p class='name'>"+ data.orders[i].name +"</p>"+
			        		"	<p>"+ data.orders[i].opt +"-"+ itemTypeFilter +"</p>"+
			        		"	<div>"+
			        		"		<p>"+ now +"</p>"+
			        		"		<span>"+ data.orders[i].date +"</span>"+
			        		"	</div>"+
			        		"	<i class='iconfont'>&#xe61d;</i>"+
			        		"</li>";
					ulDom.append(html);
					
					if(data.orders.length == $("#ulcon").children().length){
						callback();
					}
				}
			}
			
			/*$("#ordercon").on("blur",".empty",function(){
				isNotEmpty($(this))
			});
			
			$("#ordercon").on("change","select",function(){
				var iconDom = $(this).siblings(".icon");
				if(_x.isEmpty($(this).val())){
					iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
				}else{
					iconDom.children(".fail").hide().siblings(".success").show();
				}
			});
			
			var isSubmit = true;//是否可提交
			$("#subbtn").click(function(){
				if(!isSubmit)return
				isSubmit = false;
				var that = $(this);
				if(that.data("issub") == "true")return;
				var inputs = $("#ordercon").find(".empty"),
					mark = true;
				if(_x.isEmpty($("#Operator").val())){
					mark = false;
					var iconDom = $("#Operator").siblings(".icon");
					iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
				}
				if(_x.isEmpty($("#itemType").val())){
					mark = false;
					var iconDom = $("#itemType").siblings(".icon");
					iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
				}
				if(_x.isEmpty($("#opt").val())){
					mark = false;
					var iconDom = $("#opt").siblings(".icon");
					iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
				}
				inputs.each(function(){
					if(!isNotEmpty($(this))){
						mark = false;
					}
				})
				if(mark){
					$("#subbtn").html("<div class='textloading'></div>")
					var formData = $("#form").serialize();
					$.ajax({
						type:"post",
						url:"/makeprice/submitOrder",
						data:formData,
						success:function(data){
							if(data.code == "1"){
								that.data("issub","true");
								var localData = localStorage.getItem("order_id");
								if(_x.isEmpty(localData)){
									localData = [data.order_id];
								}else{
									localData = localData.split(",");
									localData.push(data.order_id)
								}
								localStorage.setItem("order_id",localData);
								window.location.href = "/userCenter/orderManager/" + data.order_id;
								
							}else{
								_x.showTip(data.msg);
								$("#subbtn").html("下一步")
							}
							isSubmit = true
						},
						error:function(){
							_x.showTip("申请失败，请填写完整信息！");
							isSubmit = true
							$("#subbtn").html("下一步")
						}
					});
				}else{
					isSubmit = true
					$("#subbtn").html("下一步")
				}
			});
			
			function isNotEmpty(input){
				var iconDom = input.siblings(".icon");
				if(_x.isEmpty(input.val())){
					iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
					input.attr("placeholder","此项不能为空！");
					return false;
				}
				
				if(input.attr("name") == "phone"){
					if(input.val().length != 11 || /[^0-9]/.test(input.val())){
						iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
						input.attr("placeholder","手机号码无效！");
						return false;
					}
				}
				
				if(input.attr("name") == "idNo"){
					if(!/(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(input.val())){
						iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
						input.attr("placeholder","身份证号码无效！");
						return false;
					}
				}
				iconDom.children(".fail").hide().siblings(".success").show();
				return true;
			};*/
    		
    		function showSuc(){
    			$("#uploadpage").removeClass("visiblecon");
    			$("#load-container").removeClass("load7");
    			var localData = localStorage.getItem("order_id");
				if(!_x.isEmpty(localData)){
					localData = localData.split(",");
					localData.forEach(function(local){
						ulDom.find("li[order_id='"+ local +"']").append("<i class='iconfont new'>&#xe60f;</i>");
					})
				}
        	}
    		
    		ulDom.on("click","li",function(){
    			if($(this).children("i.new").length > 0){
    				var order_id = $(this).attr("order_id"),
    					localData = localStorage.getItem("order_id").split(","),
    					localIndex = localData.indexOf(order_id);
    				localData.splice(localIndex,1);
    				localStorage.setItem("order_id",localData);
    			}
    		})
    		
    		/*$("#ordercon").on("change","select",function(){
    			var mark = true;
    			if(!_x.isEmpty($(this).val())){
    				$(this).parents("li").siblings("li").find("select").each(function(){
    					if(_x.isEmpty($(this).val())){
    						mark = false
    					}
    				})
    				if(mark){
    					$("#ordercon").find("li.hide").each(function(){
    						$(this).removeClass("hide")
    					})
    				}
    			}
    		})*/
    	})
    </script>
</body>
</html>